package com.gestocasa.main.helper;

import java.io.File;

import javax.swing.filechooser.FileFilter;

public class SchemeFileFilter extends FileFilter {

	@Override
	public String getDescription() {
		return "Scheme file";
	}
	
	@Override
	public boolean accept(File f) {
		if(f != null && f.getName()!= null) {
			if(f.isDirectory() == true) {
				return true;
			}
			else if(f.isFile() == true) {
				int index = f.getName().lastIndexOf(".");
				if(index >= 0) {
					String type = f.getName().substring(index);
					if(".scheme".equals(type)) {
						return true;
					}
				}
			}
		}
		return false;
	}
}
